package com.example.tvwanandroid.presenter

import com.example.tvwanandroid.base.BaseListResult
import com.example.tvwanandroid.base.BaseObserver
import com.example.tvwanandroid.base.BasePresenter
import com.example.tvwanandroid.bean.KnowledgeBean
import com.example.tvwanandroid.view.TreeView

/**
 * @作者: njb
 * @时间: 2020/12/8 10:38
 * @描述:
 */
class TreePresenter(baseView: TreeView) : BasePresenter<TreeView>(baseView) {
    fun getTree() {
        addDisposable(apiServer.tree(),object :BaseObserver<BaseListResult<KnowledgeBean.DataBean>>(baseView){
            override fun onSuccess(o: BaseListResult<KnowledgeBean.DataBean>) {
                baseView.onLoadTree(o.data!!)
            }

            override fun onError(msg: String?) {
                baseView.showError(msg!!)
            }
        })
    }
}